import * as THREE from 'three'

export const getTHREE = () => {
  return THREE
}

/**
 * 获取场景
 */
export const getScene = () => {
  THREE.Scene.prototype.openAxes = openAxes
  THREE.Scene.prototype.closeAxes = closeAxes
  const scene = new THREE.Scene()
  return scene
}

/**
 * 打开场景坐标辅助线
 * @param {*} scene 场景对象
 */
export const openAxes = (scene) => {
  const axes = new THREE.AxesHelper(10)
  scene.add(axes)
}

/**
 * 打开场景坐标辅助线
 * @param {*} scene 场景对象
 */
 export const openGridHelper = (scene, {size, divisions}) => {
  const axes = new THREE.GridHelper( size, divisions );
  scene.add(axes)
}

/**
 * 关闭场景坐标辅助线
 * @param {*} scene 场景对象
 */
export const closeAxes = (scene) => {
  const axes = new THREE.AxesHelper(10)
  scene.add(axes)
}

/**
 * 三维矢量
 * */
export const getVector3 = (x, y, z) => {
  return new THREE.Vector3(x, y, z)
}
